package com.runda.biz.controller;

import java.util.List;

import javax.annotation.Resource;

import com.bbjob.dto.Result;
import com.bbjob.model.Factory;
import com.runda.biz.service.IFactoryService;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import tk.mybatis.mapper.entity.Example;

@RestController
@RequestMapping("factory")
public class FactoryController{
    @Resource
    private IFactoryService factoryService;
    @GetMapping("list/{name}")
    public Result<List<Factory>> listBy(@PathVariable("name")Integer name){
        Example example = new Example(Factory.class);
        example.createCriteria().andLike("name", "%"+name+"%");
        List<Factory> list=this.factoryService.selectByExample(example);
        return new Result<List<Factory>>(list);
    }
    @GetMapping("listall")
    public Result<List<Factory>> listAll(){
        List<Factory> list=this.factoryService.selectByExample(null);
        return new Result<List<Factory>>(list);
    }
}